package com.air.designmodel.twelve;

import java.util.Iterator;

/**
 * @author shent
 */
public class DinerMenu {
    static final int MAX_ITEMS = 6;
    int numberOfItem = 0;
    MenuItem[] menuItems;

    public DinerMenu() {
        menuItems = new MenuItem[MAX_ITEMS];
        addItem("11111","11111",false,2.33);
        addItem("22222","22222",false,2.33);
    }

    public void addItem(String name, String description, boolean vegetarian, double price) {
        MenuItem menuItem = new MenuItem(name, description, vegetarian, price);
        if (numberOfItem >= MAX_ITEMS) {
            System.out.println("sorry menu is full");
        } else {
            menuItems[numberOfItem] = menuItem;
            numberOfItem++;
        }
    }

//        public MenuItem[] getMenuItems() {
//            return menuItems;
//        }
    public Iterator createIterator() {
        return new DinerMenuIterator(menuItems);
    }
}
